#include "cccc_mod_vio.h"
#include <iostream>

Violation::Violation() {
	violations = new vector<AViolation *> ();
}

Violation::~Violation() {

}

void Violation::addViolation(AViolation * violation) {
	this->violations->push_back(violation);
	cout << "add violation " << violation << endl;
}

vector<AViolation *>* Violation::getViolations() {
	return violations;
}

AViolation * Violation::getViolationAt(int idx) {
	return violations->at(idx);
}

void Violation::printViolation() {
	int i;
	cout << "VIOLATIONS: " << endl;
	for (i = 0; i < this->violations->size(); i++) {
		cout << this->violations->at(i)->toString() << endl;
	}
}

AViolation::AViolation(string des, string file, int line, int viotype) {
	this->description = des;
	this->file = file;
	this->line = line;
	this->viotype = viotype;
}

void AViolation::setDescription(string description) {
	this->description = description;
}
string AViolation::getDescription() {
	return this->description;
}
void AViolation::setLine(int line) {
	this->line = line;
}
int AViolation::getLine() {
	return this->line;
}
string AViolation::getFile() {
	return this->file;
}
void AViolation::setFile(string file) {
	this->file = file;
}

string AViolation::toString() {
	string retval = "";
	retval += "Violation: " + this->description;
	//retval += "@" + this->line;
	retval += " in file: ";
	retval += this->file;

	return retval;
}
